package cn.zijitc.service.impl;

import cn.zijitc.dao.UserDao;
import cn.zijitc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/*<bean id="userService" class="cn.zijitc.service.impl.UserServiceImpl">
<property name="userDao" ref="UserDao"></property>
</bean>*/

@Component("UserService")
public class UserServiceImpl implements UserService {
    @Value("${jdbc.driver}")
    private String driver;
//    @Autowired
//    @Qualifier("UserDao")
    @Resource(name = "UserDao")
    private UserDao userDao;
    public void setUserDao(UserDao userDao) {
        this.userDao=userDao;
    }

    public void save() {
        System.out.println(driver);
        userDao.save();
    }
}
